#include "stm32f10x.h"                  // Device header

#define BUZZER_Pin GPIO_Pin_12
#define BUZZER_GPIO GPIOA

void Buzzer_Init(void) {
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
	
	GPIO_InitTypeDef GPIO_InitStructure;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Pin = BUZZER_Pin;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(BUZZER_GPIO, &GPIO_InitStructure);
	
	GPIO_SetBits(BUZZER_GPIO, BUZZER_Pin);
}

void Buzzer_switch(uint8_t SWI) {
	SWI = !SWI;
	GPIO_WriteBit(BUZZER_GPIO, BUZZER_Pin, (BitAction)SWI);
}
